import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {WorkPlanForm, WorkPlanQuery, WorkPlanVO} from '@/api/painting/workPlan/types';

/**
 * 查询工作计划列表
 * @param query
 * @returns {*}
 */

export const listWorkPlan = (query?: WorkPlanQuery): AxiosPromise<WorkPlanVO[]> => {
  return request({
    url: '/painting/workPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工作计划详细
 * @param id
 */
export const getWorkPlan = (id: string | number): AxiosPromise<WorkPlanVO> => {
  return request({
    url: '/painting/workPlan/' + id,
    method: 'get'
  });
};

/**
 * 新增工作计划
 * @param data
 */
export const addWorkPlan = (data: WorkPlanForm) => {
  return request({
    url: '/painting/workPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改工作计划
 * @param data
 */
export const updateWorkPlan = (data: WorkPlanForm) => {
  return request({
    url: '/painting/workPlan',
    method: 'put',
    data: data
  });
};

/**
 * 删除工作计划
 * @param id
 */
export const delWorkPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/painting/workPlan/' + id,
    method: 'delete'
  });
};
